jqkit.userAgent = {};

/**
 * Cached scroll bar width in px.
 * @type {number} The scroll bar width in px.
 */
jqkit.userAgent.scrollBarWidth_;

/**
 * Returns the scroll bar width (represents the width of both horizontal and vertical scroll bars).
 * @return {number} The scroll bar width in px.
 */
jqkit.userAgent.getScrollBarWidth = function() {
	if (typeof(jqkit.userAgent.scrollBarWidth_) === 'number') {
		return jqkit.userAgent.scrollBarWidth_;
	}
	if (!document.body) {
		throw 'DOM not ready';
	}
	var mockElement = document.createElement('div');
	mockElement.style.cssText = 'visibility:hidden;overflow:scroll;position:absolute;top:0;width:100px;height:100px';
	document.body.appendChild(mockElement);
	var width = mockElement.offsetWidth - mockElement.clientWidth;
	mockElement.parentNode.removeChild(mockElement);
	return width;
};

/**
 * Returns whether or not the current browser supports localStorage.
 * @return {boolean} True if browser has support and False otherwise.
 */
jqkit.userAgent.supportsLocalStorage = function() {
    return ('localStorage' in window) && window['localStorage'] !== null;
};